package ch5;

public class SimpleDotCom {
	int[] locationCells;
	int numOfHits = 0;
	
	public void setLocationCells(int[] locs){
		locationCells = locs;
	}

	public String checkYourself(String stringGuess){
		int guess = Integer.parseInt(stringGuess);
		String result = "miss";
		
		for(int cells : locationCells){
			if (guess == cells){
				result = "hit";
				numOfHits++;
				break;
			}
		}
		if (numOfHits == locationCells.length){
			result = "kill";
		}
		System.out.println(result);
		return result;
	}
}
